#!/usr/bin/python
# -*- coding: utf-8 -*-

'''
1.需求：有三个办公室，8位老师，8位老师随机分配到3个办公室
'''

import random


class Teacher_office(object):
    def __init__(self, teacher_list):
        self.teacher_list = teacher_list


    def room(self):
        dict1 = {}
        room_list1 = []
        room_list2 = []
        room_list3 = []
        # 遍历老师名单，
        for i in self.teacher_list:
            dict1['{0}'.format(i)] = random.randint(1, 3)
        # print(dict1)
        # 遍历字典，
        for a, b in dict1.items():
            if b == 1:
                room_list1.append(a)
            elif b == 2:
                room_list2.append(a)
            else:
                room_list3.append(a)
        print(f' 第一间办公室是：{room_list1},\n 第二间办公室是：{room_list2},\n 第三间办公室是：{room_list3}')


if __name__ == '__main__':
    teacher_name = ['赵老师', '钱老师', '孙老师', '李老师', '周老师', '吴老师', '郑老师', '王老师']
    result = Teacher_office(teacher_name)
    result.room()


